#include "cmsis_os2.h"
#include "qlcommon.h"
#include "global.h"
#include "misc/task_misc.h"
#include "include/low_power.h"

/**
 * @brief 低功耗任务主循环
 * @param param 参数(低功耗任务对象)
 */
static void task_lowpower_entry(void *param)
{
    while (1) {
        if (cmd_sleep_status_get())
            task_lowpower_process();

        osDelay(100); // TODO: need covert tick to ms
    }
}

/**
 * @brief 低功耗任务启动函数
 */
int32_t qltask_lowpower_start(void)
{
    if (pdPASS != xTaskCreate(task_lowpower_entry, "lowpower", TASKSTACK_LOWPOWER, NULL, TASKPRI_LOWPOWER, NULL))
    {
        Error_Handler();
    }

    return 0;
}




